import 'package:flutter/material.dart';
import 'package:flowerny/main.dart';

import 'dart:async';

class SplashPage extends StatefulWidget {
  @override
  State createState() {
    return SplashState();
  }

//  SplashState createState() => SplashState();
}

class SplashState extends State<SplashPage> {
  Timer _timer;

  @override
  void initState() {
    super.initState();
    _timer = Timer(const Duration(milliseconds: 2000), () {
      Navigator.pushAndRemoveUntil(context,
          MaterialPageRoute(builder: (BuildContext context) {
        return new MyHomePage(title: 'Tiny');
      }), (router) {
        return router == null;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Color.fromARGB(255, 0, 215, 198),
      child: Container(
        alignment: Alignment(0.0, -0.1),
        child: Text(
          '张小花',
          style: TextStyle(
            color: Colors.white,
            fontSize: 50.0,
            fontWeight: FontWeight.bold,
          ),
        ),
      ),
    );
  }

  @override
  void dispose() {
    _timer.cancel();
    super.dispose();
  }
}
